﻿namespace MySql.Data.MySqlClient
{
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data.Common;
    using System.Globalization;
    using System.Reflection;
    using System.Runtime.InteropServices;
    using System.Text;

    public sealed class MySqlConnectionStringBuilder : DbConnectionStringBuilder
    {
        private bool allowBatch;
        private bool allowZeroDatetime;
        private string charSet;
        private bool compress;
        private uint connectionLifetime;
        private bool connectionReset;
        private uint connectionTimeout;
        private bool convertZeroDatetime;
        private string database;
        private static Dictionary<Keyword, object> defaultValues = new Dictionary<Keyword, object>();
        private MySqlDriverType driverType;
        private bool ignorePrepare;
        private bool logging;
        private uint maxPoolSize;
        private uint minPoolSize;
        private bool oldSyntax;
        private string originalConnectionString;
        private string password;
        private StringBuilder persistConnString;
        private bool persistSI;
        private string pipeName;
        private bool pooling;
        private uint port;
        private uint procCacheSize;
        private MySqlConnectionProtocol protocol;
        private string server;
        private string sharedMemName;
        private bool usePerfMon;
        private bool useProcedureBodies;
        private string userId;
        private bool useSSL;
        private bool useUsageAdvisor;

        static MySqlConnectionStringBuilder()
        {
            defaultValues.Add(Keyword.ConnectionTimeout, 15);
            defaultValues.Add(Keyword.Pooling, true);
            defaultValues.Add(Keyword.Port, 0xcea);
            defaultValues.Add(Keyword.Server, "");
            defaultValues.Add(Keyword.PersistSecurityInfo, false);
            defaultValues.Add(Keyword.ConnectionLifetime, 0);
            defaultValues.Add(Keyword.ConnectionReset, false);
            defaultValues.Add(Keyword.MinimumPoolSize, 0);
            defaultValues.Add(Keyword.MaximumPoolSize, 100);
            defaultValues.Add(Keyword.UserID, "");
            defaultValues.Add(Keyword.Password, "");
            defaultValues.Add(Keyword.UseUsageAdvisor, false);
            defaultValues.Add(Keyword.CharacterSet, "");
            defaultValues.Add(Keyword.Compress, false);
            defaultValues.Add(Keyword.PipeName, "MYSQL");
            defaultValues.Add(Keyword.Logging, false);
            defaultValues.Add(Keyword.OldSyntax, false);
            defaultValues.Add(Keyword.SharedMemoryName, "MYSQL");
            defaultValues.Add(Keyword.AllowBatch, true);
            defaultValues.Add(Keyword.ConvertZeroDatetime, false);
            defaultValues.Add(Keyword.Database, "");
            defaultValues.Add(Keyword.DriverType, MySqlDriverType.Native);
            defaultValues.Add(Keyword.Protocol, MySqlConnectionProtocol.Sockets);
            defaultValues.Add(Keyword.AllowZeroDatetime, false);
            defaultValues.Add(Keyword.UsePerformanceMonitor, false);
            defaultValues.Add(Keyword.ProcedureCacheSize, 0x19);
            defaultValues.Add(Keyword.UseSSL, false);
            defaultValues.Add(Keyword.IgnorePrepare, true);
            defaultValues.Add(Keyword.UseProcedureBodies, true);
        }

        public MySqlConnectionStringBuilder()
        {
            this.persistConnString = new StringBuilder();
            this.Clear();
        }

        public MySqlConnectionStringBuilder(string connectionString) : this()
        {
            this.originalConnectionString = connectionString;
            this.persistConnString = new StringBuilder();
            base.ConnectionString = connectionString;
        }

        public override void Clear()
        {
            base.Clear();
            this.persistConnString.Remove(0, this.persistConnString.Length);
            foreach (Keyword keyword in defaultValues.Keys)
            {
                this.SetValue(keyword, defaultValues[keyword]);
            }
        }

        private static bool ConvertToBool(object value)
        {
            bool flag;
            if (value is string)
            {
                string str = value.ToString().ToLower();
                switch (str)
                {
                    case "yes":
                    case "true":
                        return true;
                }
                if (!(str == "no") && !(str == "false"))
                {
                    throw new ArgumentException(Resources.ImproperValueFormat, (string) value);
                }
                return false;
            }
            try
            {
                flag = (value as IConvertible).ToBoolean(CultureInfo.InvariantCulture);
            }
            catch (InvalidCastException)
            {
                throw new ArgumentException(Resources.ImproperValueFormat, value.ToString());
            }
            return flag;
        }

        private static MySqlDriverType ConvertToDriverType(object value)
        {
            if (value is MySqlDriverType)
            {
                return (MySqlDriverType) value;
            }
            return (MySqlDriverType) Enum.Parse(typeof(MySqlDriverType), value.ToString(), true);
        }

        private static MySqlConnectionProtocol ConvertToProtocol(object value)
        {
            try
            {
                if (value is MySqlConnectionProtocol)
                {
                    return (MySqlConnectionProtocol) value;
                }
                return (MySqlConnectionProtocol) Enum.Parse(typeof(MySqlConnectionProtocol), value.ToString(), true);
            }
            catch (Exception)
            {
                if (value is string)
                {
                    switch ((value as string).ToLower())
                    {
                        case "socket":
                        case "tcp":
                            return MySqlConnectionProtocol.Sockets;

                        case "pipe":
                            return MySqlConnectionProtocol.NamedPipe;

                        case "unix":
                            return MySqlConnectionProtocol.UnixSocket;

                        case "memory":
                            return MySqlConnectionProtocol.SharedMemory;
                    }
                }
            }
            throw new ArgumentException(Resources.ImproperValueFormat, value.ToString());
        }

        private static uint ConvertToUInt(object value)
        {
            uint num2;
            try
            {
                num2 = (value as IConvertible).ToUInt32(CultureInfo.InvariantCulture);
            }
            catch (InvalidCastException)
            {
                throw new ArgumentException(Resources.ImproperValueFormat, value.ToString());
            }
            return num2;
        }

        public string GetConnectionString(bool includePass)
        {
            if (includePass)
            {
                return this.originalConnectionString;
            }
            string str = this.persistConnString.ToString();
            return str.Remove(str.Length - 1, 1);
        }

        private static Keyword GetKey(string key)
        {
            switch (key.ToLower(CultureInfo.InvariantCulture))
            {
                case "uid":
                case "username":
                case "user id":
                case "user name":
                case "userid":
                case "user":
                    return Keyword.UserID;

                case "host":
                case "server":
                case "data source":
                case "datasource":
                case "address":
                case "addr":
                case "network address":
                    return Keyword.Server;

                case "password":
                case "pwd":
                    return Keyword.Password;

                case "useusageadvisor":
                case "usage advisor":
                case "use usage advisor":
                    return Keyword.UseUsageAdvisor;

                case "character set":
                case "charset":
                    return Keyword.CharacterSet;

                case "use compression":
                case "compress":
                    return Keyword.Compress;

                case "pipe name":
                case "pipe":
                    return Keyword.PipeName;

                case "logging":
                    return Keyword.Logging;

                case "use old syntax":
                case "old syntax":
                case "oldsyntax":
                    return Keyword.OldSyntax;

                case "shared memory name":
                    return Keyword.SharedMemoryName;

                case "allow batch":
                    return Keyword.AllowBatch;

                case "convert zero datetime":
                case "convertzerodatetime":
                    return Keyword.ConvertZeroDatetime;

                case "persist security info":
                    return Keyword.PersistSecurityInfo;

                case "initial catalog":
                case "database":
                    return Keyword.Database;

                case "connection timeout":
                case "connect timeout":
                    return Keyword.ConnectionTimeout;

                case "port":
                    return Keyword.Port;

                case "pooling":
                    return Keyword.Pooling;

                case "min pool size":
                case "minimum pool size":
                    return Keyword.MinimumPoolSize;

                case "max pool size":
                case "maximum pool size":
                    return Keyword.MaximumPoolSize;

                case "connection lifetime":
                    return Keyword.ConnectionLifetime;

                case "driver":
                    return Keyword.DriverType;

                case "protocol":
                case "connection protocol":
                    return Keyword.Protocol;

                case "allow zero datetime":
                case "allowzerodatetime":
                    return Keyword.AllowZeroDatetime;

                case "useperformancemonitor":
                case "use performance monitor":
                    return Keyword.UsePerformanceMonitor;

                case "procedure cache size":
                case "procedurecachesize":
                case "procedure cache":
                case "procedurecache":
                    return Keyword.ProcedureCacheSize;

                case "connection reset":
                    return Keyword.ConnectionReset;

                case "ignore prepare":
                    return Keyword.IgnorePrepare;

                case "encrypt":
                    return Keyword.UseSSL;

                case "procedure bodies":
                case "use procedure bodies":
                    return Keyword.UseProcedureBodies;
            }
            throw new ArgumentException(Resources.KeywordNotSupported, key);
        }

        protected override void GetProperties(Hashtable propertyDescriptors)
        {
            base.GetProperties(propertyDescriptors);
            PropertyDescriptor descriptor = (PropertyDescriptor) propertyDescriptors["Connection Protocol"];
            Attribute[] array = new Attribute[descriptor.Attributes.Count];
            descriptor.Attributes.CopyTo(array, 0);
            ConnectionProtocolDescriptor descriptor2 = new ConnectionProtocolDescriptor(descriptor.Name, array);
            propertyDescriptors["Connection Protocol"] = descriptor2;
        }

        private object GetValue(Keyword kw)
        {
            switch (kw)
            {
                case Keyword.UserID:
                    return this.UserID;

                case Keyword.Password:
                    return this.Password;

                case Keyword.Server:
                    return this.Server;

                case Keyword.Port:
                    return this.Port;

                case Keyword.UseUsageAdvisor:
                    return this.UseUsageAdvisor;

                case Keyword.CharacterSet:
                    return this.CharacterSet;

                case Keyword.Compress:
                    return this.UseCompression;

                case Keyword.PipeName:
                    return this.PipeName;

                case Keyword.Logging:
                    return this.Logging;

                case Keyword.OldSyntax:
                    return this.UseOldSyntax;

                case Keyword.SharedMemoryName:
                    return this.SharedMemoryName;

                case Keyword.AllowBatch:
                    return this.AllowBatch;

                case Keyword.ConvertZeroDatetime:
                    return this.ConvertZeroDateTime;

                case Keyword.PersistSecurityInfo:
                    return this.PersistSecurityInfo;

                case Keyword.Database:
                    return this.Database;

                case Keyword.ConnectionTimeout:
                    return this.ConnectionTimeout;

                case Keyword.Pooling:
                    return this.Pooling;

                case Keyword.MinimumPoolSize:
                    return this.MinimumPoolSize;

                case Keyword.MaximumPoolSize:
                    return this.MaximumPoolSize;

                case Keyword.ConnectionLifetime:
                    return this.ConnectionLifeTime;

                case Keyword.DriverType:
                    return this.DriverType;

                case Keyword.Protocol:
                    return this.ConnectionProtocol;

                case Keyword.ConnectionReset:
                    return this.ConnectionReset;

                case Keyword.AllowZeroDatetime:
                    return this.AllowZeroDateTime;

                case Keyword.UsePerformanceMonitor:
                    return this.UsePerformanceMonitor;

                case Keyword.ProcedureCacheSize:
                    return this.ProcedureCacheSize;

                case Keyword.IgnorePrepare:
                    return this.IgnorePrepare;

                case Keyword.UseSSL:
                    return this.UseSSL;

                case Keyword.UseProcedureBodies:
                    return this.UseProcedureBodies;
            }
            return null;
        }

        public override bool Remove(string keyword)
        {
            Keyword key = GetKey(keyword);
            this.SetValue(key, defaultValues[key]);
            return base.Remove(keyword);
        }

        private void SetValue(Keyword kw, object value)
        {
            switch (kw)
            {
                case Keyword.UserID:
                    this.userId = (string) value;
                    return;

                case Keyword.Password:
                    this.password = (string) value;
                    return;

                case Keyword.Server:
                    this.server = (string) value;
                    return;

                case Keyword.Port:
                    this.port = ConvertToUInt(value);
                    return;

                case Keyword.UseUsageAdvisor:
                    this.useUsageAdvisor = ConvertToBool(value);
                    return;

                case Keyword.CharacterSet:
                    this.charSet = (string) value;
                    return;

                case Keyword.Compress:
                    this.compress = ConvertToBool(value);
                    return;

                case Keyword.PipeName:
                    this.pipeName = (string) value;
                    return;

                case Keyword.Logging:
                    this.logging = ConvertToBool(value);
                    return;

                case Keyword.OldSyntax:
                    this.oldSyntax = ConvertToBool(value);
                    return;

                case Keyword.SharedMemoryName:
                    this.sharedMemName = (string) value;
                    return;

                case Keyword.AllowBatch:
                    this.allowBatch = ConvertToBool(value);
                    return;

                case Keyword.ConvertZeroDatetime:
                    this.convertZeroDatetime = ConvertToBool(value);
                    return;

                case Keyword.PersistSecurityInfo:
                    this.persistSI = ConvertToBool(value);
                    return;

                case Keyword.Database:
                    this.database = (string) value;
                    return;

                case Keyword.ConnectionTimeout:
                    this.connectionTimeout = ConvertToUInt(value);
                    return;

                case Keyword.Pooling:
                    this.pooling = ConvertToBool(value);
                    return;

                case Keyword.MinimumPoolSize:
                    this.minPoolSize = ConvertToUInt(value);
                    return;

                case Keyword.MaximumPoolSize:
                    this.maxPoolSize = ConvertToUInt(value);
                    return;

                case Keyword.ConnectionLifetime:
                    this.connectionLifetime = ConvertToUInt(value);
                    return;

                case Keyword.DriverType:
                    this.driverType = ConvertToDriverType(value);
                    return;

                case Keyword.Protocol:
                    this.protocol = ConvertToProtocol(value);
                    return;

                case Keyword.ConnectionReset:
                    this.connectionReset = ConvertToBool(value);
                    return;

                case Keyword.AllowZeroDatetime:
                    this.allowZeroDatetime = ConvertToBool(value);
                    return;

                case Keyword.UsePerformanceMonitor:
                    this.usePerfMon = ConvertToBool(value);
                    return;

                case Keyword.ProcedureCacheSize:
                    this.procCacheSize = ConvertToUInt(value);
                    return;

                case Keyword.IgnorePrepare:
                    this.ignorePrepare = ConvertToBool(value);
                    return;

                case Keyword.UseSSL:
                    this.useSSL = ConvertToBool(value);
                    return;

                case Keyword.UseProcedureBodies:
                    this.useProcedureBodies = ConvertToBool(value);
                    return;
            }
        }

        private void SetValue(string keyword, object value)
        {
            if (value == null)
            {
                throw new ArgumentException(Resources.KeywordNoNull, keyword);
            }
            Keyword key = GetKey(keyword);
            this.SetValue(key, value);
            base[keyword] = value;
            if (key != Keyword.Password)
            {
                this.persistConnString.AppendFormat(CultureInfo.InvariantCulture, "{0}={1};", new object[] { keyword, value });
            }
        }

        public override bool TryGetValue(string keyword, out object value)
        {
            try
            {
                Keyword key = GetKey(keyword);
                value = this.GetValue(key);
                return true;
            }
            catch (ArgumentException)
            {
            }
            value = null;
            return false;
        }

        [Category("Connection"), DisplayName("Allow Batch"), Description("Allows execution of multiple SQL commands in a single statement"), DefaultValue(true), RefreshProperties(RefreshProperties.All)]
        public bool AllowBatch
        {
            get
            {
                return this.allowBatch;
            }
            set
            {
                this.SetValue("Allow Batch", value);
                this.allowBatch = value;
            }
        }

        [DisplayName("Allow Zero Datetime"), DefaultValue(false), RefreshProperties(RefreshProperties.All), Description("Should zero datetimes be supported"), Category("Advanced")]
        public bool AllowZeroDateTime
        {
            get
            {
                return this.allowZeroDatetime;
            }
            set
            {
                this.SetValue("Allow Zero Datetime", value);
                this.allowZeroDatetime = value;
            }
        }

        [Description("Character set this connection should use"), RefreshProperties(RefreshProperties.All), DisplayName("Character Set"), Category("Advanced")]
        public string CharacterSet
        {
            get
            {
                return this.charSet;
            }
            set
            {
                this.SetValue("Character Set", value);
                this.charSet = value;
            }
        }

        [RefreshProperties(RefreshProperties.All), DisplayName("Connection Lifetime"), Description("The minimum amount of time (in seconds) for this connection to live in the pool before being destroyed."), DefaultValue(0), Category("Pooling")]
        public uint ConnectionLifeTime
        {
            get
            {
                return this.connectionLifetime;
            }
            set
            {
                this.SetValue("Connection Lifetime", value);
                this.connectionLifetime = value;
            }
        }

        [DefaultValue(0), Category("Connection"), DisplayName("Connection Protocol"), Description("Protocol to use for connection to MySQL"), RefreshProperties(RefreshProperties.All)]
        public MySqlConnectionProtocol ConnectionProtocol
        {
            get
            {
                return this.protocol;
            }
            set
            {
                this.SetValue("Connection Protocol", value);
                this.protocol = value;
            }
        }

        [Description("When true, indicates the connection state is reset when removed from the pool."), DefaultValue(true), RefreshProperties(RefreshProperties.All), Category("Pooling"), DisplayName("Connection Reset")]
        public bool ConnectionReset
        {
            get
            {
                return this.connectionReset;
            }
            set
            {
                this.SetValue("Connection Reset", value);
                this.connectionReset = value;
            }
        }

        [RefreshProperties(RefreshProperties.All), DisplayName("Connect Timeout"), Description("The length of time (in seconds) to wait for a connection to the server before terminating the attempt and generating an error."), DefaultValue(15), Category("Connection")]
        public uint ConnectionTimeout
        {
            get
            {
                return this.connectionTimeout;
            }
            set
            {
                this.SetValue("Connect Timeout", value);
                this.connectionTimeout = value;
            }
        }

        [DisplayName("Convert Zero Datetime"), Description("Should illegal datetime values be converted to DateTime.MinValue"), Category("Advanced"), DefaultValue(false), RefreshProperties(RefreshProperties.All)]
        public bool ConvertZeroDateTime
        {
            get
            {
                return this.convertZeroDatetime;
            }
            set
            {
                this.SetValue("Convert Zero Datetime", value);
                this.convertZeroDatetime = value;
            }
        }

        [Category("Connection"), Description("Database to use initially"), RefreshProperties(RefreshProperties.All)]
        public string Database
        {
            get
            {
                return this.database;
            }
            set
            {
                this.SetValue("Database", value);
                this.database = value;
            }
        }

        [DisplayName("Driver Type"), Browsable(false), DefaultValue(0), Description("Specifies the type of driver to use for this connection"), RefreshProperties(RefreshProperties.All), Category("Connection")]
        public MySqlDriverType DriverType
        {
            get
            {
                return this.driverType;
            }
            set
            {
                this.SetValue("Driver Type", value);
                this.driverType = value;
            }
        }

        [Description("Instructs the provider to ignore any attempts to prepare a command."), RefreshProperties(RefreshProperties.All), DefaultValue(true), Category("Advanced"), DisplayName("Ignore Prepare")]
        public bool IgnorePrepare
        {
            get
            {
                return this.ignorePrepare;
            }
            set
            {
                this.SetValue("Ignore Prepare", value);
                this.ignorePrepare = value;
            }
        }

        public override object this[string key]
        {
            get
            {
                Keyword kw = GetKey(key);
                return this.GetValue(kw);
            }
            set
            {
                if (value == null)
                {
                    this.Remove(key);
                }
                else
                {
                    this.SetValue(key, value);
                }
            }
        }

        [RefreshProperties(RefreshProperties.All), DefaultValue(false), Category("Connection"), Description("Enables output of diagnostic messages")]
        public bool Logging
        {
            get
            {
                return this.logging;
            }
            set
            {
                this.SetValue("Logging", value);
                this.logging = value;
            }
        }

        [Category("Pooling"), DefaultValue(100), RefreshProperties(RefreshProperties.All), DisplayName("Maximum Pool Size"), Description("The maximum number of connections allowed in the pool.")]
        public uint MaximumPoolSize
        {
            get
            {
                return this.maxPoolSize;
            }
            set
            {
                this.SetValue("Maximum Pool Size", value);
                this.maxPoolSize = value;
            }
        }

        [Category("Pooling"), DisplayName("Minimum Pool Size"), Description("The minimum number of connections allowed in the pool."), DefaultValue(0), RefreshProperties(RefreshProperties.All)]
        public uint MinimumPoolSize
        {
            get
            {
                return this.minPoolSize;
            }
            set
            {
                this.SetValue("Minimum Pool Size", value);
                this.minPoolSize = value;
            }
        }

        [RefreshProperties(RefreshProperties.All), Description("Indicates the password to be used when connecting to the data source."), Category("Security"), PasswordPropertyText(true)]
        public string Password
        {
            get
            {
                return this.password;
            }
            set
            {
                this.SetValue("Password", value);
                this.password = value;
            }
        }

        [RefreshProperties(RefreshProperties.All), DisplayName("Persist Security Info"), Category("Security"), Description("When false, security-sensitive information, such as the password, is not returned as part of the connection if the connection is open or has ever been in an open state.")]
        public bool PersistSecurityInfo
        {
            get
            {
                return this.persistSI;
            }
            set
            {
                this.SetValue("Persist Security Info", value);
                this.persistSI = value;
            }
        }

        [Category("Connection"), RefreshProperties(RefreshProperties.All), DisplayName("Pipe Name"), Description("Name of pipe to use when connecting with named pipes (Win32 only)"), DefaultValue("MYSQL")]
        public string PipeName
        {
            get
            {
                return this.pipeName;
            }
            set
            {
                this.SetValue("Pipe Name", value);
                this.pipeName = value;
            }
        }

        [Description("When true, the connection object is drawn from the appropriate pool, or if necessary, is created and added to the appropriate pool."), Category("Pooling"), DefaultValue(true), RefreshProperties(RefreshProperties.All)]
        public bool Pooling
        {
            get
            {
                return this.pooling;
            }
            set
            {
                this.SetValue("Pooling", value);
                this.pooling = value;
            }
        }

        [DefaultValue(0xcea), Description("Port to use for TCP/IP connections"), Category("Connection"), RefreshProperties(RefreshProperties.All)]
        public uint Port
        {
            get
            {
                return this.port;
            }
            set
            {
                this.SetValue("Port", value);
                this.port = value;
            }
        }

        [RefreshProperties(RefreshProperties.All), DefaultValue(0x19), Category("Advanced"), DisplayName("Procedure Cache Size"), Description("Indicates how many stored procedures can be cached at one time. A value of 0 effectively disables the procedure cache.")]
        public uint ProcedureCacheSize
        {
            get
            {
                return this.procCacheSize;
            }
            set
            {
                this.SetValue("Procedure Cache Size", value);
                this.procCacheSize = value;
            }
        }

        [Category("Connection"), RefreshProperties(RefreshProperties.All), Description("Server to connect to")]
        public string Server
        {
            get
            {
                return this.server;
            }
            set
            {
                this.SetValue("Server", value);
                this.server = value;
            }
        }

        [DefaultValue("MYSQL"), DisplayName("Shared Memory Name"), RefreshProperties(RefreshProperties.All), Category("Connection"), Description("Name of the shared memory object to use")]
        public string SharedMemoryName
        {
            get
            {
                return this.sharedMemName;
            }
            set
            {
                this.SetValue("Shared Memory Name", value);
                this.sharedMemName = value;
            }
        }

        [DefaultValue(false), RefreshProperties(RefreshProperties.All), DisplayName("Use Compression"), Category("Connection"), Description("Should the connection ues compression")]
        public bool UseCompression
        {
            get
            {
                return this.compress;
            }
            set
            {
                this.SetValue("Use Compression", value);
                this.compress = value;
            }
        }

        [RefreshProperties(RefreshProperties.All), DefaultValue(false), Description("Allows the use of old style @ syntax for parameters"), Category("Connection"), DisplayName("Use Old Syntax")]
        public bool UseOldSyntax
        {
            get
            {
                return this.oldSyntax;
            }
            set
            {
                this.SetValue("Use Old Syntax", value);
                this.oldSyntax = value;
            }
        }

        [RefreshProperties(RefreshProperties.All), DefaultValue(false), Category("Advanced"), DisplayName("Use Performance Monitor"), Description("Indicates that performance counters should be updated during execution.")]
        public bool UsePerformanceMonitor
        {
            get
            {
                return this.usePerfMon;
            }
            set
            {
                this.SetValue("Use Performance Monitor", value);
                this.usePerfMon = value;
            }
        }

        [DefaultValue(true), RefreshProperties(RefreshProperties.All), DisplayName("Use Procedure Bodies"), Description("Indicates if stored procedure bodies will be available for parameter detection."), Category("Advanced")]
        public bool UseProcedureBodies
        {
            get
            {
                return this.useProcedureBodies;
            }
            set
            {
                this.SetValue("Use Procedure Bodies", value);
                this.useProcedureBodies = value;
            }
        }

        [DisplayName("User Id"), Category("Security"), Description("Indicates the user ID to be used when connecting to the data source."), RefreshProperties(RefreshProperties.All)]
        public string UserID
        {
            get
            {
                return this.userId;
            }
            set
            {
                this.SetValue("User Id", value);
                this.userId = value;
            }
        }

        [Description("Should the connection use SSL.  This currently has no effect."), DefaultValue(false), RefreshProperties(RefreshProperties.All), Category("Authentication")]
        internal bool UseSSL
        {
            get
            {
                return this.useSSL;
            }
            set
            {
                this.SetValue("UseSSL", value);
                this.useSSL = value;
            }
        }

        [DisplayName("Use Usage Advisor"), Description("Logs inefficient database operations"), DefaultValue(false), RefreshProperties(RefreshProperties.All), Category("Advanced")]
        public bool UseUsageAdvisor
        {
            get
            {
                return this.useUsageAdvisor;
            }
            set
            {
                this.SetValue("Use Usage Advisor", value);
                this.useUsageAdvisor = value;
            }
        }
    }
}

